package dds;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import com.coflight.cfl.IOData.External.CorrelationData.CorrelationTopic;



public class DDSTypeManager {

	private static Map<String, DDSTypes> mapDDSTypes = new HashMap< String, DDSTypes>();
	
	public static void init() {
		mapDDSTypes.clear();
		
		addDDSTypes("com.coflight.cfl.IOData.External.Flight.ExternalFlight", "ExternalFlight", "ExternalFlight");
		addDDSTypes("com.coflight.cfl.IOData.External.TechSup.SupervisedObject", "TechSup", "TechSup");
		addDDSTypes("com.thalesgroup.CdmwPlatformMngt.SystemSnapshot", "SupervisedObject", "SupervisedObject");
		addDDSTypes("com.coflight.cfl.IOData.Common.BasicATM.Misc.WarningOccurenceData", "FPLWarning", "FPLWarning");
		addDDSTypes("com.coflight.cfl.IOData.External.CorrelationData.CorrelationTopic", "CorrelationData", "CorrelationTopic");
		addDDSTypes("com.coflight.cfl.IOData.External.CorrelationData.CorrelationTopic", "CorrelationData", "CorrelationData");
		addDDSTypes("com.coflight.cfl.IOData.Common.BasicATM.AnalysisAndFunctionalData.Indicators", "DAFSTATS", "DAFSTATS");

	}
	
	public static void addDDSTypes(String typeName, String topicName, String fileName) {
		DDSTypes dds = new DDSTypes(typeName, topicName, fileName);
		mapDDSTypes.put(fileName, dds);		
	}
	
	public static DDSTypes getDDSTypes(File f) {
		
		String fileName = f.getName();
		int idx = fileName.indexOf("-");
		String name = fileName.substring(0, idx);
		
		DDSTypes dds = mapDDSTypes.get(name);
		return dds;
		
	}
}
